package com.ruiyian.project.equipment.service.impl;

import com.ruiyian.common.core.domain.entity.Point;
import com.ruiyian.project.equipment.mapper.PointMapper;
import com.ruiyian.project.equipment.service.PointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author chong
 * @email 673426164@qq.com
 * @create 2021/7/15
 * Desc: 点位实现
 */
@Service
public class PointServiceImpl implements PointService {
    @Autowired
    private PointMapper pointMapper;

    @Override
    public List<Point> selectList(Point point) {
        return pointMapper.selectList(point);
    }

    @Override
    public List<Point> selectPointList(Point point) {
        return pointMapper.selectPointList(point);
    }

    @Override
    public void save(Point point) {
        pointMapper.save(point);
    }

    @Override
    public void edit(Point point) {
        pointMapper.edit(point);
    }

    @Override
    public Point findOne(Long id) {
        return pointMapper.findOne(id);
    }

    @Override
    public void delete(Long id) {
        pointMapper.delete(id);
    }

    @Override
    public void updateValue(Point point) {
        pointMapper.updateValue(point);
    }

    @Override
    public Point findByTunnelId(Point point) {
        return pointMapper.findByTunnelId(point);
    }

    @Override
    public void updateBatch(List<Point> list) {
        pointMapper.updateBatch(list);
    }


    @Override
    public void importData(List<Point> list) {
        list.stream().peek(p->{
            this.save(p);
        }).collect(Collectors.toList());
    }
}
